/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package javahomework04;

/**
 *
 * @author 朱荻 2010405121
 */
import java.io.*;
public class CheckID {
    public static void inputid() throws IOException{
        InputStream in1 = System.in;
        InputStreamReader in2 = new InputStreamReader(in1);
        BufferedReader in3 = new BufferedReader(in2);
        System.out.println("请输入您的身份证号码:");
        String id = in3.readLine();
        String str="0123456789Xx";
        boolean flag=true;
        for (int i = 0; i < id.length(); i++) {
            char c=id.charAt(i);
            int temp=str.indexOf(c);
            if (temp<0) {
                flag=false;
                break;
            }
        }
        if (id.length()<18) {
            flag=false;
        }
        if (flag) {
            System.out.println("您输入的身份证:    "+id+"    是正确的!");
        } else {
            System.out.println("您输入的身份证:    "+id+"    是错误的!");
        }
    }
    public static void main(String[] args) throws IOException {
        inputid();
    }
}
